﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace LloydGame
{
    public class UserInput : Singleton<UserInput>
    {
        protected KeyboardState m_prevKeyboardState, m_keyboardState;
        protected MouseState m_prevMouseState, m_mouseState;

        public KeyboardState prevKeyboardState
        {
            get
            {
                return m_prevKeyboardState;
            }
        }

        public KeyboardState keyboardState
        {
            get
            {
                return m_keyboardState;
            }
        }

        public MouseState prevMouseState
        {
            get
            {
                return m_prevMouseState;
            }
        }

        public MouseState mouseState
        {
            get
            {
                return m_mouseState;
            }
        }

        // constructor
        public UserInput()
        {
            m_keyboardState = Keyboard.GetState();
            m_mouseState = Mouse.GetState();

            update();
        }

        // update keyboard and mouse states
        public void update()
        {
            m_prevKeyboardState = m_keyboardState;
            m_prevMouseState = m_mouseState;

            m_keyboardState = Keyboard.GetState();
            m_mouseState = Mouse.GetState();
        }
    }
}
